import { IPrefab, PrefabPath } from "../../config/PrefabPath";
import DialogBase, { IDialogBase } from "../../core/common/DialogBase";
import MusicManager from "../../core/managers/MusicManager";
import UIManager from "../../core/managers/UIManager";
import { UserStore } from "../../core/store/UserStore";

const { ccclass, property } = cc._decorator;
/**
 * 登陆奖励
 */
@ccclass
export default class DialogLevelSuccess extends DialogBase implements IDialogBase {
    skinPrefab: IPrefab = PrefabPath.levelSuccess;

    @property({ type: cc.Button, displayName: '下一关' })
    btnPlayNext: cc.Button = null;

    @property({ type: cc.AudioClip, displayName: '通关音效' })
    successMusic: cc.AudioClip = null;

    onShow() {
        MusicManager.playEffect(this.successMusic, false);
    }
    start() {

    }
    onNext() {
        UIManager.hide(this.skinPrefab);
        UserStore.Ins.addLevel();
    }
}
